import { defineConfig, searchForWorkspaceRoot } from 'vite'
import vue from '@vitejs/plugin-vue'
const path = require('path')

import AutoImport from 'unplugin-auto-import/vite'

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: tag => /^micro-app/.test(tag)
        }
      }
    }),
    AutoImport({
      imports:['vue','vue-router'] // 自动导入vue和vue-router相关函数
    })
  ],
  resolve: {
    //设置路径别名
    alias: {
      '@': path.resolve(__dirname, './src')
    },
  },
  server: {
    port: 3000,
    // 设置代理
		proxy:{
			'/api':'http://testapi.xuexiluxian.cn'
    },
    fs: {
      allow: [
        searchForWorkspaceRoot(process.cwd()),
        '/mygit/micro-zoe/micro-app/'
      ]
    }
  },
  base: '/main-vite/',
})
